load("@rules_java//java:defs.bzl", "java_library")
load("//:cel_android_rules.bzl", "cel_android_library")

package(
    default_applicable_licenses = [
        "//:license",
    ],
    default_visibility = [
        "//common/values:__pkg__",
    ],
)

# keep sorted
CEL_VALUES_SOURCES = [
    "BoolValue.java",
    "BytesValue.java",
    "CelValueConverter.java",
    "DoubleValue.java",
    "DurationValue.java",
    "EnumValue.java",
    "ErrorValue.java",
    "ImmutableListValue.java",
    "ImmutableMapValue.java",
    "IntValue.java",
    "ListValue.java",
    "MapValue.java",
    "NullValue.java",
    "OpaqueValue.java",
    "OptionalValue.java",
    "SelectableValue.java",
    "StringValue.java",
    "StructValue.java",
    "TimestampValue.java",
    "TypeValue.java",
    "UintValue.java",
]

# keep sorted
PROTO_MESSAGE_VALUE_SOURCES = [
    "ProtoCelValueConverter.java",
    "ProtoMessageValue.java",
]

java_library(
    name = "cel_value",
    srcs = ["CelValue.java"],
    tags = [
    ],
    deps = [
        "//common/annotations",
        "//common/types:type_providers",
        "@maven//:com_google_errorprone_error_prone_annotations",
    ],
)

cel_android_library(
    name = "cel_value_android",
    srcs = ["CelValue.java"],
    tags = [
    ],
    deps = [
        "//common/annotations",
        "//common/types:type_providers_android",
        "@maven//:com_google_errorprone_error_prone_annotations",
    ],
)

java_library(
    name = "cel_value_provider",
    srcs = ["CelValueProvider.java"],
    tags = [
    ],
    deps = [
        ":cel_value",
        "@maven//:com_google_errorprone_error_prone_annotations",
        "@maven//:com_google_guava_guava",
    ],
)

cel_android_library(
    name = "cel_value_provider_android",
    srcs = ["CelValueProvider.java"],
    tags = [
    ],
    deps = [
        ":cel_value_android",
        "@maven//:com_google_errorprone_error_prone_annotations",
        "@maven_android//:com_google_guava_guava",
    ],
)

java_library(
    name = "combined_cel_value_provider",
    srcs = ["CombinedCelValueProvider.java"],
    tags = [
    ],
    deps = [
        "//common/values:cel_value",
        "//common/values:cel_value_provider",
        "@maven//:com_google_errorprone_error_prone_annotations",
        "@maven//:com_google_guava_guava",
    ],
)

cel_android_library(
    name = "combined_cel_value_provider_android",
    srcs = ["CombinedCelValueProvider.java"],
    tags = [
    ],
    deps = [
        ":cel_value_android",
        "//common/values:cel_value_provider_android",
        "@maven//:com_google_errorprone_error_prone_annotations",
        "@maven_android//:com_google_guava_guava",
    ],
)

java_library(
    name = "values",
    srcs = CEL_VALUES_SOURCES,
    tags = [
    ],
    deps = [
        ":cel_byte_string",
        ":cel_value",
        "//:auto_value",
        "//common:error_codes",
        "//common:runtime_exception",
        "//common/annotations",
        "//common/types",
        "//common/types:type_providers",
        "@maven//:com_google_errorprone_error_prone_annotations",
        "@maven//:com_google_guava_guava",
        "@maven//:org_jspecify_jspecify",
    ],
)

cel_android_library(
    name = "values_android",
    srcs = CEL_VALUES_SOURCES,
    tags = [
    ],
    deps = [
        ":cel_byte_string",
        ":cel_value_android",
        "//:auto_value",
        "//common:error_codes",
        "//common:runtime_exception",
        "//common/annotations",
        "//common/types:type_providers_android",
        "//common/types:types_android",
        "@maven//:com_google_errorprone_error_prone_annotations",
        "@maven//:org_jspecify_jspecify",
        "@maven_android//:com_google_guava_guava",
    ],
)

java_library(
    name = "cel_byte_string",
    srcs = ["CelByteString.java"],
    # used_by_android
    tags = [
    ],
    deps = [
        "@maven//:com_google_errorprone_error_prone_annotations",
    ],
)

java_library(
    name = "base_proto_cel_value_converter",
    srcs = ["BaseProtoCelValueConverter.java"],
    tags = [
    ],
    deps = [
        ":cel_byte_string",
        ":cel_value",
        ":values",
        "//common/annotations",
        "//common/internal:proto_time_utils",
        "//common/internal:well_known_proto",
        "@maven//:com_google_errorprone_error_prone_annotations",
        "@maven//:com_google_guava_guava",
        "@maven//:com_google_protobuf_protobuf_java",
    ],
)

cel_android_library(
    name = "base_proto_cel_value_converter_android",
    srcs = ["BaseProtoCelValueConverter.java"],
    tags = [
    ],
    deps = [
        ":cel_byte_string",
        ":cel_value_android",
        ":values_android",
        "//common/annotations",
        "//common/internal:proto_time_utils_android",
        "//common/internal:well_known_proto_android",
        "@maven//:com_google_errorprone_error_prone_annotations",
        "@maven_android//:com_google_guava_guava",
        "@maven_android//:com_google_protobuf_protobuf_javalite",
    ],
)

java_library(
    name = "proto_message_value",
    srcs = PROTO_MESSAGE_VALUE_SOURCES,
    tags = [
    ],
    deps = [
        ":base_proto_cel_value_converter",
        ":cel_value",
        ":values",
        "//:auto_value",
        "//common/annotations",
        "//common/internal:cel_descriptor_pools",
        "//common/internal:dynamic_proto",
        "//common/internal:well_known_proto",
        "//common/types",
        "//common/types:type_providers",
        "@maven//:com_google_errorprone_error_prone_annotations",
        "@maven//:com_google_guava_guava",
        "@maven//:com_google_protobuf_protobuf_java",
        "@maven//:org_jspecify_jspecify",
    ],
)

java_library(
    name = "proto_message_value_provider",
    srcs = ["ProtoMessageValueProvider.java"],
    tags = [
    ],
    deps = [
        ":base_proto_message_value_provider",
        ":cel_value",
        ":proto_message_value",
        "//common:options",
        "//common/annotations",
        "//common/internal:dynamic_proto",
        "//common/internal:proto_message_factory",
        "//common/values:base_proto_cel_value_converter",
        "@maven//:com_google_errorprone_error_prone_annotations",
        "@maven//:com_google_protobuf_protobuf_java",
    ],
)

java_library(
    name = "proto_message_lite_value",
    srcs = [
        "ProtoLiteCelValueConverter.java",
        "ProtoMessageLiteValue.java",
    ],
    tags = [
    ],
    deps = [
        ":base_proto_cel_value_converter",
        ":cel_value",
        ":values",
        "//:auto_value",
        "//common/annotations",
        "//common/internal:cel_lite_descriptor_pool",
        "//common/internal:well_known_proto",
        "//common/types",
        "//common/types:type_providers",
        "//common/values:cel_byte_string",
        "//protobuf:cel_lite_descriptor",
        "@maven//:com_google_errorprone_error_prone_annotations",
        "@maven//:com_google_guava_guava",
        "@maven//:com_google_protobuf_protobuf_java",
        "@maven//:org_jspecify_jspecify",
        "@maven_android//:com_google_protobuf_protobuf_javalite",
    ],
)

cel_android_library(
    name = "proto_message_lite_value_android",
    srcs = [
        "ProtoLiteCelValueConverter.java",
        "ProtoMessageLiteValue.java",
    ],
    tags = [
    ],
    deps = [
        ":base_proto_cel_value_converter_android",
        ":cel_value_android",
        ":values_android",
        "//:auto_value",
        "//common/annotations",
        "//common/internal:cel_lite_descriptor_pool_android",
        "//common/internal:well_known_proto_android",
        "//common/types:type_providers_android",
        "//common/types:types_android",
        "//common/values:cel_byte_string",
        "//protobuf:cel_lite_descriptor",
        "@maven//:com_google_errorprone_error_prone_annotations",
        "@maven//:com_google_guava_guava",
        "@maven//:org_jspecify_jspecify",
        "@maven_android//:com_google_guava_guava",
        "@maven_android//:com_google_protobuf_protobuf_javalite",
    ],
)

java_library(
    name = "proto_message_lite_value_provider",
    srcs = ["ProtoMessageLiteValueProvider.java"],
    tags = [
    ],
    deps = [
        ":base_proto_message_value_provider",
        ":cel_value",
        ":proto_message_lite_value",
        "//common/annotations",
        "//common/internal:cel_lite_descriptor_pool",
        "//common/internal:default_lite_descriptor_pool",
        "//common/values:base_proto_cel_value_converter",
        "//protobuf:cel_lite_descriptor",
        "@maven//:com_google_errorprone_error_prone_annotations",
        "@maven//:com_google_guava_guava",
        "@maven_android//:com_google_protobuf_protobuf_javalite",
    ],
)

cel_android_library(
    name = "proto_message_lite_value_provider_android",
    srcs = ["ProtoMessageLiteValueProvider.java"],
    tags = [
    ],
    deps = [
        ":base_proto_message_value_provider_android",
        ":cel_value_android",
        ":proto_message_lite_value_android",
        "//common/annotations",
        "//common/internal:cel_lite_descriptor_pool_android",
        "//common/internal:default_lite_descriptor_pool_android",
        "//common/values:base_proto_cel_value_converter_android",
        "//protobuf:cel_lite_descriptor",
        "@maven//:com_google_errorprone_error_prone_annotations",
        "@maven_android//:com_google_guava_guava",
        "@maven_android//:com_google_protobuf_protobuf_javalite",
    ],
)

java_library(
    name = "base_proto_message_value_provider",
    srcs = ["BaseProtoMessageValueProvider.java"],
    tags = [
    ],
    deps = [
        "//common/annotations",
        "//common/values:base_proto_cel_value_converter",
        "//common/values:cel_value_provider",
        "@maven//:com_google_errorprone_error_prone_annotations",
    ],
)

cel_android_library(
    name = "base_proto_message_value_provider_android",
    srcs = ["BaseProtoMessageValueProvider.java"],
    tags = [
    ],
    deps = [
        "//common/annotations",
        "//common/values:base_proto_cel_value_converter_android",
        "//common/values:cel_value_provider_android",
        "@maven//:com_google_errorprone_error_prone_annotations",
    ],
)
